#ifndef _FLASH_MOVIE_H_
#define _FLASH_MOVIE_H_

#include "math/vec2.h"
#include <string>
#include "gameswf/gameswf_types.h"

namespace gameswf
{
	struct player;
	struct movie_definition;
	struct root;
};

namespace flash
{
class FlashMovie
{
public:
	FlashMovie();
	~FlashMovie();

	bool				Load(const std::string& File);
	void				Tick(float dt);
	void				Render(const math::Vec2&	From, const math::Vec2& Size);
	void				SetPause(bool b) { m_Pause = b; };
	bool				GetPause() const { return m_Pause; };
	
	void				SetLoop(bool b) { m_Looping = b; };
	bool				GetLoop() const { return m_Looping; };
	const std::string&	GetFile() const { return m_File; };
	void				Reset();
	
	typedef void		(*ClipEndFunc)(FlashMovie* pSelf, void* pPayload);	
	void				ClipEndedEvent(ClipEndFunc pFunc, void* pPayload) { m_pClipEndFunc = pFunc; m_pPayload = pPayload; };
private:
	gameswf::gc_ptr<gameswf::root>				m_pMovie;
	int							m_MovieVersion; 
	float						m_MovieFPS;
	float						m_SpeedScale;
	bool						m_Pause;
	bool						m_Looping;
	std::string					m_File;

	ClipEndFunc					m_pClipEndFunc;
	void*						m_pPayload;
};

};	//namespace flash

#endif // _FLASH_MOVIE_H_